package com.klw.business.service.impl;

import java.util.List;
import com.klw.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.klw.business.mapper.KlwSemesterMapper;
import com.klw.business.domain.KlwSemester;
import com.klw.business.service.IKlwSemesterService;

/**
 * 学期Service业务层处理
 * 
 * @author klw
 * @date 2025-08-24
 */
@Service
public class KlwSemesterServiceImpl implements IKlwSemesterService 
{
    @Autowired
    private KlwSemesterMapper klwSemesterMapper;

    /**
     * 查询学期
     * 
     * @param semesterId 学期主键
     * @return 学期
     */
    @Override
    public KlwSemester selectKlwSemesterBySemesterId(Long semesterId)
    {
        return klwSemesterMapper.selectKlwSemesterBySemesterId(semesterId);
    }

    /**
     * 查询学期列表
     * 
     * @param klwSemester 学期
     * @return 学期
     */
    @Override
    public List<KlwSemester> selectKlwSemesterList(KlwSemester klwSemester)
    {
        return klwSemesterMapper.selectKlwSemesterList(klwSemester);
    }

    /**
     * 新增学期
     * 
     * @param klwSemester 学期
     * @return 结果
     */
    @Override
    public int insertKlwSemester(KlwSemester klwSemester)
    {
        klwSemester.setCreateTime(DateUtils.getNowDate());
        return klwSemesterMapper.insertKlwSemester(klwSemester);
    }

    /**
     * 修改学期
     * 
     * @param klwSemester 学期
     * @return 结果
     */
    @Override
    public int updateKlwSemester(KlwSemester klwSemester)
    {
        klwSemester.setUpdateTime(DateUtils.getNowDate());
        return klwSemesterMapper.updateKlwSemester(klwSemester);
    }

    /**
     * 批量删除学期
     * 
     * @param semesterIds 需要删除的学期主键
     * @return 结果
     */
    @Override
    public int deleteKlwSemesterBySemesterIds(Long[] semesterIds)
    {
        return klwSemesterMapper.deleteKlwSemesterBySemesterIds(semesterIds);
    }

    /**
     * 删除学期信息
     * 
     * @param semesterId 学期主键
     * @return 结果
     */
    @Override
    public int deleteKlwSemesterBySemesterId(Long semesterId)
    {
        return klwSemesterMapper.deleteKlwSemesterBySemesterId(semesterId);
    }
}
